<% layout('/layout/default.html', {title: '区域管理', libs: ['layui']}){ %>
<div class="main-content">
		<div class="card-header">
				<i class="fa fa-sitemap"></i> 区域管理
			<div class="header-tools float-right">
				<a href="#" class="btn btn-default btn-sm"  id="btnRefreshTree" title="刷新"><i class="fa fa-refresh"></i> 刷新</a>
				<a href="#" class="btn btn-default btn-sm" id="btnExpandTreeNode" title="展开全部"><i class="fa fa-angle-double-down"></i> 展开</a>
				<a href="#" class="btn btn-default btn-sm" id="btnCollapseTreeNode" title="折叠全部"><i class="fa fa-angle-double-up"></i> 折叠</a>
				<% if(hasPermi('sys:area:edit')){ %>
					<a href="/sys/area/form" class="btn btn-default btn-sm btnTool" title="添加根区域"><i class="fa fa-plus"></i> 添加根区域</a>
				<% } %>
			</div>
		</div>
		<div class="container-fluid">
			<form id="searchForm" action="${ctx}/sys/area/listData" class="form-inline d-none">
				<button type="submit" class="btn btn-default btn-sm">查询</button>
				<button type="reset" class="btn btn-default btn-sm">重置</button>
			</form>
			<table id="btGrid"></table>
		</div>
</div>
<% } %>
<script>
//初始化layui-table对象
	$('#btGrid').BTGrid({
		searchForm: $("#searchForm"),
		treeEnable: true,
		columnModel: [
			{title:'区域名称', field:'name'},
			{title:'区域编码', field:'code'},
			{title:'区域类型', templet: function(row){
                    return js.transDictLabel(${@DictUtils.getDictListJson('sys_area_type')}, row.type, '');
			}},
			{title:'排序', field:'sort'},
			{title:'备注', field:'remarks'},
			{title:'操作', templet: function(row){
				var actions = [];
				<% if(hasPermi('sys:area:edit')){ %>
                    actions.push('<a href="/sys/area/form?parentId='+row.id+'" class="btn btn-xs btn-success btnList" title="添加下级区域"><i class="fa fa-plus-square"></i></a>&nbsp&nbsp');
					actions.push('<a href="/sys/area/form?id='+row.id+'" class="btn btn-xs btn-primary btnList" title="修改区域信息"><i class="far fa-edit"></i></a>&nbsp&nbsp');
					actions.push('<a href="${ctx}/sys/area/delete?id='+row.id+'" class="btn btn-xs btn-danger btnList" title="删除区域" data-confirm="要删除该区域及所有子区域项吗？"><i class="far fa-trash-alt"></i></a>');

				<% } %>
				return actions.join('');
			}}
		],
		// 加载成功后执行事件
		ajaxSuccess: function(data){
			
		}
	});
</script>